#include <iostream>
using namespace std;

int main (void)
{
	volatile int *pi = new int;
	*pi = 100;
	cout << *pi << endl;
	delete pi; 
	pi = NULL;
	
	pi = new int(20); //申请并初始化为20
	cout << *pi << endl;
	(*pi)++;
	cout << *pi << endl;

	//new数组
	//int *parr = new int[10];
	//new数组并初始化
	int *parr = new int[10] {10,9,8,7,6,5,4,3,2,1};
	for (int i = 0; i < 10; i++) {
		parr[i] = i+1; 
		cout << parr[i] << ' ';
	}
	cout << endl;
	delete[] parr;
	parr = NULL;

	return 0;
}
